package com.xxxx.aop;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class Component1 {

    @Autowired
    private ApplicationEventPublisher publisher;

    public void publish(){
        log.info("用户注册");
        System.out.println("用户注册");
        publisher.publishEvent(new UserRegisteredEvent(this));
    }
}
